<!DOCTYPE html>
<html lang="zh-CN" style="height: 100%">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">

    <link rel="stylesheet" href="/static/css/layout.css">
    <title>虚拟货币比价系统 -- 用户登录</title>
    <style>
        input::-webkit-input-placeholder, textarea::-webkit-input-placeholder {
            color:    #fff;
        }
        input:-moz-placeholder, textarea:-moz-placeholder {
            color:    #fff;
        }
        input::-moz-placeholder, textarea::-moz-placeholder {
            color:    #fff;
        }
        input:-ms-input-placeholder, textarea:-ms-input-placeholder {
            color:    #fff;
        }
        input {
            outline: none;
            -webkit-appearance: none;
            border-radius: 0;
            border-style: none;
            background-color: transparent;
        }
    </style>
</head>
<!--<body background="/static/img/bg.png" style=" background-repeat:no-repeat ;-->
<!--background-size:100% 100%;-->
<!--background-attachment: fixed;height: 100%;display:flex;justify-content:center;align-items:center;">-->

<body style="height: 100%">
<div class="login-form" style="padding-top: 3%">
    <div class="top-login">
        <span><img src="/static/img/group.png" alt=""/></span>
    </div>
    <h1>虚拟货币比价系统</h1>
    <div class="login-top">
        <form>
            <div class="login-ic">
                <i ></i>
                <input type="text"  placeholder="请输入用户名" id="username"/>
                <div class="clear"> </div>
            </div>
            <div class="login-ic">
                <i class="icon"></i>
                <input type="password"  placeholder="请输入密码" id="password"/>
                <div class="clear"> </div>
            </div>

            <div class="log-bwn">
                <input type="button"  onclick="login()" value="登录" >
            </div>
        </form>
    </div>
    <p class="copy">© 2017 markgu.top  QQ:734432004</p>
</div>



<!--[if lt IE 9]>
<script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
<script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<script src="/static/layui/layui.js"></script>
<script>
  var $, layer;
  layui.use('layer', function () {
    $ = layui.jquery;
    layer = layui.layer;

    if (window !== window.top) {
      parent.window.location.href = '/admin/login'
    }
  });


  function login() {
    var username = $('#username').val();
    var password = $('#password').val();
    if (!username) {
      layer.msg('用户名不能为空', {
        time: 2000,
      });
      return;
    }

    if (!password) {
      layer.msg('密码不能为空', {
        time: 2000,
      });
      return;
    }
    $.post('/auth/login', {
      username: username,
      password: password
    }, function (data) {
      if (data.errno === 0) {
        localStorage.tmToken = data.data.token;
        window.location.href = '/admin?x-tm-token='
          + localStorage.tmToken;
      } else {
        layer.msg('用户名或者密码不正确', {
          time: 2000,
        });
      }
    });
  }
</script>
</body>
</html>